package com.dabaozhan.modules.wx_app.service.impl;

import java.util.Date;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dabaozhan.common.utils.Utils;
import com.dabaozhan.modules.wx_app.dao.SiteOutRecordMapper;
import com.dabaozhan.modules.wx_app.entity.SiteOutRecordEntity;
import com.dabaozhan.modules.wx_app.service.SiteOutRecordService;

@Service("siteOutService")
public class SiteOutRecordServiceImpl implements SiteOutRecordService{
	
	@Autowired
	private SiteOutRecordMapper siteOutRecordMapper;

	@Override
	public int addOutRecord(SiteOutRecordEntity entity) {
		if(StringUtils.isBlank(entity.getId())){
			entity.setId(Utils.id().toString());
		}
		return siteOutRecordMapper.addOutRecord(entity);
	}

	@Override
	public int updateArriveRecord(SiteOutRecordEntity entity) {
		return siteOutRecordMapper.updateArriveRecord(entity);
	}

	@Override
	public List<SiteOutRecordEntity> getBalanceBill(String userId, Integer settleStatus, Date beginTime, Date endTime,Integer beginIndex,Integer endIndex) {
		return siteOutRecordMapper.getBalanceBill(userId, settleStatus, beginTime, endTime,beginIndex,endIndex);
	}

	@Override
	public int updateSettleStatus(SiteOutRecordEntity entity) {
		return siteOutRecordMapper.updateSettleStatus(entity);
	}

	@Override
	public List<SiteOutRecordEntity> getOutRecord(String userId, Integer placeStatus, Integer beginIndex,Integer endIndex) {
		return siteOutRecordMapper.getOutRecord(userId, placeStatus, beginIndex, endIndex);
	}

	@Override
	public long getOutRecordCountForPage(String userId, Integer placeStatus) {
		return siteOutRecordMapper.getOutRecordCountForPage(userId, placeStatus);
	}

	@Override
	public long getBalanceBillCountForPage(String userId, Integer settleStatus, Date beginTime, Date endTime) {
		return siteOutRecordMapper.getBalanceBillCountForPage(userId, settleStatus, beginTime, endTime);
	}

	@Override
	public SiteOutRecordEntity getRecordByOrderSerial(String orderSerial) {
		return siteOutRecordMapper.getRecordByOrderSerial(orderSerial);
	}
	
}
